package com.maizhi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.maizhi.dao.FilesDaoI;
import com.maizhi.dao.impl.Page;
import com.maizhi.model.Files;
import com.maizhi.service.FilesServiceI;


@Service("fileService")
public class FilesServiceImpl extends BaseServiceImpl implements FilesServiceI {

	FilesDaoI fileDao;
	
	public FilesDaoI getFileDao() {
		return fileDao;
	}

	@Autowired
	public void setFileDao(FilesDaoI fileDao) {
		this.fileDao = fileDao;
	}

	public List<Files> getFilesList(Page page) {
		String hql="FROM Files t";
		page.setCount(fileDao.getHqlCounts(hql));
		List<Files> list = fileDao.findByHqlAndPage(hql+" ORDER BY t.createDate desc", page);
		return list;
	}

}
